﻿Ext.define("App.View.Socios.Forms", {
    extend: "App.Config.Abstract.Form",
    title: "",
    botones: false,
    columns: 2,
    icono : '',
    EventosForm : null,
    scope : null,
    initComponent: function () {
        var me = this;
        if (me.opcion == "FormImagen") {
            me.CargarFormImagen();

        }
        else if (me.opcion == 'formFamiliar') {
            me.title = "Datos Familiares";
            me.CargarFormFamiliar();
        }
        else if (me.opcion == 'formResumen') {
            me.title = "Resumen";
            me.CargarFormResumen();
        }
        this.callParent(arguments);
    },
    CargarFormImagen: function () {
        var me = this;
        me.scope = me.scope == null ? this : me.scope;
        var changingImage = Ext.create('Ext.Img', {
//            width : 240,
//            height : 100,
            colspan : 2,
            src: 'http://localhost/extjs/extjs/docs/images/Ext.Img/Ext.Img.png',
//            renderTo: Ext.getBody()
        });
        var buttonCrear = Funciones.CrearMenu('btn_Crear_imagen', 'Crear Socio', 'image_add', me.EventosForm, null, me.scope);
        var buttonVer = Funciones.CrearMenu('btn_Ver_imagen', 'Ver Imagen', 'image_link', me.EventosForm, null, me.scope);

        me.items = [
        changingImage ,
        buttonCrear,
        buttonVer
        ];
    },
//    EventosForm : function(btn)
//    {
//        var me = this;
//        switch (btn.getItemId()) {
//            case "btn_Crear_imagen":
//                me.BotonesSocio(false);
//                break;
//            default:
//                Ext.Msg.alert("Aviso", "No Existe el botton");
//        }
//    },
    CargarFormResumen: function () {
        var me = this;
        var label1 = Ext.create("Ext.form.Label", {
            text: 'LITROS',
            cls : 'resaltarAzulRight',

        });
        var label2 = Ext.create("Ext.form.Label", {
            text: 'P-COSTO',
            cls : 'resaltarAzul',
        });
        var label3 = Ext.create("Ext.form.Label", {
            text: 'P-VENTA',
            cls : 'resaltarAzul',
        });
        me.txt_diesel = Ext.create("App.Config.Componente.TextFieldBase", {
            fieldLabel: "Diesel",
            name: "COD_POSTE",
            width: 180,
            colspan: 1,
            emptyText: ''
        });
        me.txt_diesel_costo = Ext.create("App.Config.Componente.TextFieldBase", {
            fieldLabel: "",
            name: "COD_POSTE",
            width: 70,
            colspan: 1,
            emptyText: ''
        });
        me.txt_diesel_venta = Ext.create("App.Config.Componente.TextFieldBase", {
            fieldLabel: "",
            name: "COD_POSTE",
            width: 70,
            colspan: 1,
            emptyText: ''
        });
        me.txt_gasolina = Ext.create("App.Config.Componente.TextFieldBase", {
            fieldLabel: "Gasolina",
            name: "AREA_UBIC",
            width: 180,
            emptyText: '',
            colspan: 1
        });
        me.txt_gasolina_costo = Ext.create("App.Config.Componente.TextFieldBase", {
            fieldLabel: "",
            name: "AREA_UBIC",
            width: 70,
            colspan: 1,
            emptyText: ''
        });
        me.txt_gasolina_venta = Ext.create("App.Config.Componente.TextFieldBase", {
            fieldLabel: "",
            name: "AREA_UBIC",
            width: 70,
            colspan: 1,
            emptyText: ''
        });

        me.items = [
        label1,
        label2,
        label3,
        me.txt_diesel,
        me.txt_diesel_costo,
        me.txt_diesel_venta,
        me.txt_gasolina,
        me.txt_gasolina_costo,
        me.txt_gasolina_venta
        ];
    },
    CargarFormFamiliar : function(){
        var me = this;
            me.txt_id = Ext.create("App.Config.Componente.TextFieldBase", {
                name: "ID_FAMILIAR",
                hidden: true,
            });
            me.txt_id_socio = Ext.create("App.Config.Componente.TextFieldBase", {
                name: "ID_SOCIO",
                hidden: true,
            });
            me.txt_id_chofer = Ext.create("App.Config.Componente.TextFieldBase", {
                name: "ID_CHOFER",
                hidden: true,
            });
            me.txt_nombre = Ext.create("App.Config.Componente.TextFieldBase", {
                fieldLabel: "Nombres",
                name: "NOMBRE",
                width: 480,
                colspan : 2,
                maxLength: 200,
                afterLabelTextTpl: Constantes.REQUERIDO,
                allowBlank: false,
            });
            me.txt_apellido_paterno = Ext.create("App.Config.Componente.TextFieldBase", {
                fieldLabel: "Ap.Paterno",
                name: "APELLIDO_PATERNO",
                width: 240,
                maxLength: 200,
                afterLabelTextTpl: Constantes.REQUERIDO,
                allowBlank: false,
            });
            me.txt_apellido_materno = Ext.create("App.Config.Componente.TextFieldBase", {
                fieldLabel: "Ap.Materno",
                name: "APELLIDO_MATERNO",
                width: 240,
                maxLength: 200,
                afterLabelTextTpl: Constantes.REQUERIDO,
                allowBlank: false,
            });
            me.num_ci = Ext.create("App.Config.Componente.NumberFieldBase", {
                fieldLabel: "Carnet Identidad",
                name: "CI",
                width: 240,
                maxLength: 15,
                allowNegative: false,
                allowDecimals: false,
            });
            me.store_expedido = Ext.create('App.Store.Listas.StoreLista');
            me.store_expedido.setExtraParam('ID_LISTA', Lista.Buscar('EXPEDIDO_CI'));
            me.cbx_expedido = Ext.create("App.Config.Componente.ComboBase", {
                fieldLabel: "Expedido",
                name: "EXPEDIDO",
                width: 240,
                store : me.store_expedido,
                selectOnFocus: true,
            });
            me.dat_fecha_nac = Ext.create("App.Config.Componente.DateFieldBase", {
                opcion :"sin fecha",
                fieldLabel: "Fecha Nacimiento",
                name: "FECHA_NAC",
                width: 240,
                afterLabelTextTpl: Constantes.REQUERIDO,
                allowBlank: false,
            });
            me.store_parentesco = Ext.create('App.Store.Listas.StoreLista');
            me.store_parentesco.setExtraParam('ID_LISTA', Lista.Buscar('PARENTESCO'));
            me.cbx_parentesco = Ext.create("App.Config.Componente.ComboBase", {
                fieldLabel: "Parentesco",
                name: "PARENTESCO",
                width: 240,
                store : me.store_parentesco,
                selectOnFocus: true,
                afterLabelTextTpl: Constantes.REQUERIDO,
                allowBlank: false,
            });
            me.txt_observacion = Ext.create("App.Config.Componente.TextFieldBase", {
                fieldLabel: "Observaciones",
                name: "OBSERVACION",
                width: 480,
                colspan : 2,
                maxLength: 500,
            });
            
            me.items = [
                me.txt_id,
                me.txt_id_socio,
                me.txt_id_chofer,
                me.txt_nombre,
                me.txt_apellido_paterno,
                me.txt_apellido_materno,
                me.num_ci,
                me.cbx_expedido,
                me.dat_fecha_nac,
                me.cbx_parentesco,
                me.txt_observacion,
            ];
    }
});
